<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>文章表</title>
  <t:base type="ckfinder,ckeditor,jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript" src="plug-in/ckeditor_new/ckeditor.js"></script>
  <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
  <script type="text/javascript">
  var xmlHttp;
  function createXmlhttp()
  {
  	xmlHttp=false;
  	if(window.XMLHttpRequest)
  	{
  		xmlHttp=new XMLHttpRequest(); 
  	}
  	else if(window.ActiveXobject)
  	{
  		try{
  		xmlHttp=new ActiveXobject("Msxml2.XMLHTTP");
  		}
  		catch(e)
  		{
  			try{
  			xmlHttp=new ActiveXobject("Microsoft.XMLHTTP");
  			}
  			catch(e)
  			{
  			}
  		}
  		
  	}
  	if(!xmlHttp)
  	{
  		window.alert("can not create");
  		return false;
  	}
  }
  function query(getName)
  {
  	//alert("dsf");
  	createXmlhttp();
  	
  	if(getName=="getArea")
  	{
  		
  		xmlHttp.onreadystatechange=checked;
  		xmlHttp.open("POST", "<%=request.getContextPath()%>/bnsArticleController.do?getAreaGroup&flag="+getName+"&id="+document.all.area.value);
  	}
  	
  	else if(getName=="getGroup")
  	{
  		xmlHttp.onreadystatechange=checked2;
  		xmlHttp.open("POST", "<%=request.getContextPath()%>/bnsArticleController.do?getAreaGroup&flag="+ getName + "&id=" + document.all.group.value);
  		}

  		xmlHttp.send(null);
  	}
  	function checked() {
  		//alert(xmlHttp.readyState);
  		if (xmlHttp.readyState == 4) {
  			if (xmlHttp.status == 200) {

  				var xml = xmlHttp.responseXML;
  				//alert(xml.toString());
  				var value = xml.getElementsByTagName("element");
  				while (document.all.group.options.length > 0) {
  					document.all.group
  							.removeChild(document.all.group.childNodes[0]);
  				}
  				for (i = 0; i < value.length + 1; i++) {
  					var option = document.createElement("option");
  					// 				option.value='请选择';
  					// 				option.text='请选择';  
  					option.value = value[i].childNodes[0].childNodes[0].nodeValue;
  					option.text = value[i].childNodes[1].childNodes[0].nodeValue;
  					document.all.group.options.add(option);
  				}

  			}
  		}

  	}
  	function checked2() {
  		//alert(xmlHttp.readyState);
  		if (xmlHttp.readyState == 4) {
  			if (xmlHttp.status == 200) {

  				var xml = xmlHttp.responseXML;
  				//alert(xml.toString());
  				var value = xml.getElementsByTagName("element");
  				while (document.all.theme.options.length > 0) {
  					document.all.theme
  							.removeChild(document.all.theme.childNodes[0]);
  				}
  				for (i = 0; i < value.length; i++) {
  					var option = document.createElement("option");
  					option.value = value[i].childNodes[0].childNodes[0].nodeValue;
  					option.text = value[i].childNodes[1].childNodes[0].nodeValue;
  					document.all.theme.options.add(option);
  				}

  			}
  		}

  	}
  </script>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="bnsArticleController.do?doUpdate" tiptype="1">
					<input id="id" name="id" type="hidden" value="${bnsArticlePage.id }">
					<input id="createName" name="createName" type="hidden" value="${bnsArticlePage.createName }">
					<input id="createDate" name="createDate" type="hidden" value="${bnsArticlePage.createDate }">
					<input id="commentsNum" name="commentsNum" type="hidden" value="${bnsArticlePage.commentsNum }">
					<input id="browseNum" name="browseNum" type="hidden" value="${bnsArticlePage.browseNum }">
		<table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
					<tr>
						<td align="right">
							<label class="Validform_label">
								标题:
							</label>
						</td>
						<td class="value">
						     	 <input id="title" name="title" type="text" style="width: 150px" class="inputxt"  datatype="s1-50" value='${bnsArticlePage.title}'>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">标题</label>
						</td>
					<tr>
						<td align="right">
							<label class="Validform_label">
								内容:
							</label>
						</td>
						<td class="value">
<%-- 						      		<input id="content" name="content" type="text" style="width: 150px" class="inputxt"  datatype="s1-1000"  value='${bnsArticlePage.content}'> --%>
							<t:ckeditor name="content" isfinder="true" value="${bnsArticlePage.content}" type="width:700"></t:ckeditor>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">内容</label>
						</td>
					</tr>
					<tr>
						<td align="right">
							<label class="Validform_label">
								主题:
							</label>
						</td>
						<td class="value">
							<select name='area' onchange="query('getArea')">
<%-- 								<option>${bnsArticlePage.areaName}</option>								 --%>
								<c:forEach items="${arealist}" var="pl">
									<c:choose>
										<c:when test="${bnsArticlePage.areaId == pl.id}">
											<option value="${pl.id}" selected="selected">${pl.areaName}</option>
										</c:when>
										<c:otherwise>
											<option value="${pl.id}">${pl.areaName}</option>
										</c:otherwise>
									</c:choose>									
								</c:forEach>
							</select>
			
							<select name='group' onchange="query('getGroup')">
<!-- 								<option>请选择板块</option> -->
								<c:forEach items="${grouplist}" var="gl">
									<c:if test="${bnsArticlePage.groupId == gl.id}">
										<option value="${gl.id}" selected="selected">${gl.articleGroupName}</option>	
									</c:if>																												
								</c:forEach>
							</select>
			
							<select name='theme'>
<!-- 								<option>请选择主题</option> -->
								<c:forEach items="${themelist}" var="tl">
									<c:if test="${bnsArticlePage.themeId == tl.id}">
										<option value="${tl.id}" selected="selected">${tl.themeName}</option>	
									</c:if>																												
								</c:forEach>
							</select>
						</td>
					<tr>
						<td align="right">
							<label class="Validform_label">
								文章标签:
							</label>
						</td>
						<td class="value">
									<t:dictSelect field="articleLabel" type="checkbox"
										typeGroupCode="artLab" defaultVal="${bnsArticlePage.articleLabel}" hasLabel="false"  title="文章标签"></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">文章标签</label>
						</td>
					</tr>
					<tr>
						<td align="right">
							<label class="Validform_label">
								发布状态:
							</label>
						</td>
						<td class="value">
									<t:dictSelect field="publisherStates" type="radio"
										typeGroupCode="pbsSta" defaultVal="${bnsArticlePage.publisherStates}" hasLabel="false"  title="发布状态"></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">发布状态</label>
						</td>
					<tr>
						<td align="right">
							<label class="Validform_label">
								置顶:
							</label>
						</td>
						<td class="value">
									<t:dictSelect field="isUp" type="list"
										typeGroupCode="sf_yn" defaultVal="${bnsArticlePage.isUp}" hasLabel="false"  title="置顶"></t:dictSelect>     
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">置顶</label>
						</td>
					</tr>
			</table>
		</t:formvalid>
 </body>
  <script src = "webpage/com/buss/article/bnsArticle.js"></script>		